package com.yun.zf.common.app.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yun.zf.common.admin.domain.ZfSchools;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 社区表
 * </p>
 *
 * @author cj
 * @since 2021-01-29
 */
@TableName("zf_community")
@Data
public class ZfCommunity implements Serializable {

    private static final long serialVersionUID = 1L;
    private Long id;

    @NotBlank(message = "小区名称不能为空")
    @ApiModelProperty(value = "小区名称")
    private String communityName;


    @ApiModelProperty(value = "省级区划代码")
    private Long provinceCode;

    @ApiModelProperty(value = "市级区划编号")
    private Long cityCode;

    @ApiModelProperty(value = "区域代码")
    private Long regionCode;

    @ApiModelProperty(value = "街道区划代码")
    private  Long streetCode;

    @ApiModelProperty(value = "省级名称")
    private String provinceName;
    @ApiModelProperty(value = "城市名称")
    private String cityName;

    @ApiModelProperty(value = "区域名称")
    private String regionName;

    @ApiModelProperty(value = "街道名称")
    private String streetName;

    @ApiModelProperty(value = "地址")
    private String address;

    @ApiModelProperty(value = "建成年份")
    @NotBlank(message = "建成年份不能为空")
    private int ctyBuildYear;

    @ApiModelProperty(value = "开发企业")
    @NotBlank(message = "开发企业不能为空")
    private String development;



    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date modifiedTime;

    @ApiModelProperty(value = "楼栋总数")
    private Integer totalBuilding;

    @ApiModelProperty(value = "房屋总数")
    private Integer totalHouse;

    @ApiModelProperty(value = "物业公司")
    @NotBlank(message = "物业公司不能为空")
    private String propertyCompany;

    @ApiModelProperty(value = "物业电话")
    private String propertyTel;

    @ApiModelProperty(value = "物业费")
    private String propertyCosts;

    @ApiModelProperty(value = "供暖类型")
    private String heating;

    @ApiModelProperty(value = "地上车位数")
    private Integer parkingGround;

    @ApiModelProperty(value = "地下车位数")
    private Integer parkingUnder;

    @ApiModelProperty(value = "地下停车费")
    private String parkingUnderFee;

    @ApiModelProperty(value = "地上停车费")
    private String parkingGroundFee;

    @ApiModelProperty(value = "车位配比")
    private String parkingRatio;

    @ApiModelProperty(value = "是否人车分流Y是N否")
    private String isPv;

    @ApiModelProperty(value = "小区经纬度")
    private String location;
    @ApiModelProperty(value = "是否热门小区")
    private String isHotC;
    @ApiModelProperty(value = "是否品质小区")
    private String isBrandC;
    @ApiModelProperty(value = "品质推荐理由")
    private String brandReason;
    @ApiModelProperty(value = "小区状态")
    private  String cStatus;


    // 将经纬度转成地理位置推送es
    @TableField(exist = false)
    private GeoPoint point;

    public GeoPoint getPoint() {
         double lat =Double.parseDouble( location.split(",")[1]);
         double lon =Double.parseDouble( location.split(",")[0]);
        GeoPoint point = new GeoPoint(lat,lon);
        return point;
    }

    public void setPoint(GeoPoint point) {
        this.point = point;
    }
}
